/*
** my_getnbr.c for Jour_04 in /u/all/noret_a/rendu/piscine/Jour_04
**
** Made by christophe noret
** Login   <noret_a@epitech.net>
**
** Started on  Fri Oct  5 21:56:35 2012 christophe noret
** Last update Tue Oct 23 17:54:40 2012 christophe noret
*/

int     my_getnbr(char *str)
{
  int	k;
  int   i;
  int   nb;

  i = 0;
  k = 1;
  while (str[i] != '\0' && (str[i] == '+' || str[i] == '-'))
    {
      if (str[i] == '-')
	k = k * -1;
      i++;
    }
  str = str + i;
  nb = 0;
  i = 0;
  while (str[i] >= '0' && str[i] <= '9')
    {
      nb = nb * 10;
      nb = nb + (str[i] - '0');
      i++;
    }
  return (nb * k);
}
